<template>
	<view class="wrap">
		<view class="main">
			<g-item>
				<template v-slot:left>
					<view class="item-left">优惠券金额</view>
				</template>
				<template v-slot:right>
					<view class="item-right" style="color: #FF7733;">￥50</view>
				</template>
			</g-item>
			<g-item>
				<template v-slot:left>
					<view class="item-left">适用商家</view>
				</template>
				<template v-slot:right>
					<view class="item-right">小布布料</view>
				</template>
			</g-item>
			<g-item>
				<template v-slot:left>
					<view class="item-left">使用条件</view>
				</template>
				<template v-slot:right>
					<view class="item-right">满1000减50</view>
				</template>
			</g-item>
			<g-item>
				<template v-slot:left>
					<view class="item-left">有效期至</view>
				</template>
				<template v-slot:right>
					<view class="item-right">2021-04-30</view>
				</template>
			</g-item>
		</view>
		<view class="btn">
			<g-btn title="确认核销" @click="chargeoffCoupon"></g-btn>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				couponRecordId: ''
			}
		},
		methods: {
			chargeoffCoupon() {
				console.log('heheh');
				if (!this.couponRecordId) {
					uni.showToast({
						title: '核销失败，优惠券ID缺失',
						icon: 'none'
					})
					return
				}
				this.$g_api.couponOfflineCancelCoupon({
					couponRecordId: this.couponRecordId
				}).then(({
					data
				}) => {
					uni.showToast({
						title: '核销成功'
					})
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.main {
		margin-top: 20rpx;
	}

	.item-left {}

	.item-right {}

	.btn {
		margin-top: 150rpx;
	}
</style>
